/*
	Name:9_T5
	Copyright:Take it at will
	Author:Rodney
	Date: 
	Description:
*/
#include<stdio.h>
#include<string.h>
void strlshif(char *s,int n);

int main()
{
	char a[100];
	int n;
	scanf("%s",a);
	scanf("%d",&n);
	strlshif(a,n);
	printf("%s\n",a);
}

void strlshif(char *s,int n)
{
	int i,j;
	char ch;
	for(i=0;i<n;i++)
	{
		ch = *s;
		for(j=0;j<strlen(s)-1;j++)
			*(s+j) = *(s+j+1);
		*(s+j) = ch;
	}
}
